package main

import (
	"fmt"
	"go_data_structures_and_algorithms/tool"
)

/*
归并排序有两种实现方式一种是递归实现一种是非递归实现
1.递归实现重点在合并的那个步骤
*/
func main() {

	arr5 := []int{2, 3, 4, 51, 2, 4, 3, 4, 1}
	Process(arr5, 0, len(arr5)-1)
	fmt.Println(arr5)
}

func Process(arr []int, L, R int) {
	if L == R {
		return
	}

	Mid := (L + R) / 2
	Process(arr, L, Mid)
	Process(arr, Mid+1, R)
	tool.Merge(arr, L, Mid, R)
}
